package com.itheima.pojo;

import com.itheima.utils.DateUtils;

import java.io.Serializable;
import java.util.Date;

public class Item implements Serializable {

    private Integer id;//主键
    private String subject;//题目名称
    private String type;//题目类型
    private Date time;//创建时间
    private String important;//是否必填
    private String timeStr;

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getSubject() {
        return subject;
    }

    public void setSubject(String subject) {
        this.subject = subject;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public Date getTime() {
        return time;
    }

    public void setTime(Date time) {
        this.time = time;
    }

    public String getImportant() {
        return important;
    }

    public void setImportant(String important) {
        this.important = important;
    }

    public String getTimeStr() throws Exception {
        if(time != null){
            return DateUtils.parseDate2String(time);
        }
        return null;
    }
}
